{extend name="index_layout"/}
{block name="main"}
<form class="layui-form" method="post">

    <div class="layui-form-item">
        <label class="layui-form-label">企业名称</label>
        <div class="layui-input-block">
            <input id="c-name" lay-verify="required" class=" layui-input" name="row[name]" type="text" value="{$data.name}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">企业图片</label>
        <div class="layui-input-block">
            <div class="layui-col-xs4">
                <input id="c-image" lay-verify="required" class=" layui-input" size="50" name="row[image]" type="text" value="{$data.image}">
            </div>
            <button type="button" id="faupload-image" class="layui-btn faupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-image"><i class="layui-icon layui-icon-upload"></i> 上传</button><button type="button" id="fachoose-image" class="layui-btn fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="iconfont icon-other"></i> 选择</button>
            <ul class="layui-row list-inline plupload-preview" id="p-image"></ul>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">电话</label>
        <div class="layui-input-block">
            <input id="c-phone" lay-verify="required" class=" layui-input" name="row[phone]" type="text" value="{$data.phone}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">地址</label>
        <div class="layui-input-block">
            <input id="c-address" lay-verify="required" class=" layui-input" name="row[address]" type="text" value="{$data.address}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">主要业务</label>
        <div class="layui-input-block">
            {:Form::textarea('row[describe]',$data.describe,["lay-verify"=>"required"])}
        </div>
    </div>


    <div class="layui-form-item">
        {php}$address = parse_attr($vo['value']);{/php}
        <div class="layui-form-item">
            <label class="layui-form-label">定位 {if condition="isset($vo.ifrequire) AND
                $vo.ifrequire"}&nbsp;<font color="red">*</font>{/if}</label>
            <div class="layui-form-field-label">
                <!--默认是天安门的维度116.404|39.915-->
                <div class="layui-input-inline">
                    <input id="longitude" name="row[longitude]" placeholder="请输入经度"
                           class="layui-input map-location-input" lay-verType="tips"
                           value="{$data.longitude}"/>
                </div>
                <div class="layui-input-inline">
                    <input id="latitude" name="row[latitude]" placeholder="请输入纬度"
                           class="layui-input" lay-verType="tips" value="{$data.latitude}"/>
                </div>
                <div class="layui-input-inline">
                    <button id="locationBtn" type="button" class="layui-btn"><i
                            class="layui-icon layui-icon-location map-location"></i>定位
                    </button>
                </div>
            </div>
            {if $vo.remark}
            <div class="layui-form-mid layui-word-aux">{$vo.remark|raw}</div>
            {/if}
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">排序</label>
        <div class="layui-input-block">
            <input id="c-sort" lay-verify="required" class=" layui-input" name="row[sort]" value="{$data.sort}" type="text">
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-block">
            <input type="radio" name="row[status]" value="1" title="显示" {if $data.status==1}checked{/if}>
            <input type="radio" name="row[status]" value="0" title="隐藏" {if $data.status==0}checked{/if}>
        </div>
    </div>

    <div class="layui-form-item layer-footer">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
{/block}
{block name="script"}

<script>
    window.HOST_TYPE = 1;

    layui.config({
        version: '{$Think.config.version.yzncms_release}',
        base: '__STATIC__/libs/layui_exts/'
    }).extend({
        locationX: '../../addons/address/locationX',
        location: '../../addons/address/location',
    }).use(['layer', 'form', 'jquery', 'location'], function () {
        $ = layui.jquery;
        var form = layui.form;
        var location = layui.location;

        location.render("#locationBtn", {
            type: 1,
            apiType: "baiduMap",
            coordinate: "baiduMap",
            mapType: 2,
            zoom: 15,
            title: '区域定位',
            init: function () {
                return {longitude: $("#longitude").val(), latitude: $("#latitude").val()};
            },
            success: function (data) {
                $("#longitude").val(data.lng);
                $("#latitude").val(data.lat);
            }
        });
    });
</script>


<script type="text/javascript">
layui.use('yznForm', function() {
    var yznForm = layui.yznForm;
    yznForm.bindevent($("form.layui-form"));
});
</script>
{/block}